package craky.keeper.allpay;

import java.io.Serializable;
import java.sql.Date;
import java.sql.Timestamp;
import java.text.ParseException;

import craky.keeper.KeeperConst;

public class AllPay implements Serializable {
	private static final long serialVersionUID = -4154649567321567697L;
	private int id;
	private Date date;
	private float amount;
	private String summary;
	private String type;
	private String detail;
	private String remark;
	private Timestamp recordTime;
	private String recorder;

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public float getAmount() {
		return this.amount;
	}

	public void setAmount(float amount) {
		this.amount = amount;
	}

	public String getAmountString() {
		return KeeperConst.AMOUNT_FORMAT.format(this.amount);
	}

	public void setAmountString(String amountString) {
		try {
			setAmount(KeeperConst.AMOUNT_FORMAT.parse(amountString)
					.floatValue());
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}

	public String getSummary() {
		return this.summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getDetail() {
		return this.detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Timestamp getRecordTime() {
		return this.recordTime;
	}

	public void setRecordTime(Timestamp recordTime) {
		this.recordTime = recordTime;
	}

	public String getRecorder() {
		return this.recorder;
	}

	public void setRecorder(String recorder) {
		this.recorder = recorder;
	}

	@Override
	public String toString() {
		StringBuilder str = new StringBuilder();
		char comma = ',';
		str.append(String.valueOf(getDate()));
		str.append(comma);
		str.append(getAmountString());
		str.append(comma);
		str.append(getSummary());
		str.append(comma);
		str.append(getType());
		str.append(comma);
		str.append(getDetail());
		str.append(comma);
		str.append(getRemark());
		str.append(comma);
		str.append(String.valueOf(getRecordTime()));
		str.append(comma);
		str.append(getRecorder());
		return str.toString();
	}
}